import api from "@/api/api";
import Vue from "vue";
import HomeInfo from "./home-info.vue";
import HomeGuide from "./home-guide.vue";
export default {
    components: {
        "home-info": HomeInfo,
        "home-guide": HomeGuide
    },

    data() {
        return {
            userName: "管理员",
            menuArray: [],
            logoUrl: require("@/project-demo/assets/images/home/ic_home_logo.jpeg"),
            personUrl: require("@/project-demo/assets/images/home/ic_home_person.png"),
            centerUrl: require("@/project-demo/assets/images/home/ic_home_center.png"),
            exitUrl: require("@/project-demo/assets/images/home/ic_home_exit.png"),
            menuTag: "home",
        }
    },
    methods: {
        guideItemClick(tag) {
            switch (tag) {
                case "system":
                    this.infoItemClick(this.systemMenu, 0, tag);
                    return;
                case "city":
                    this.infoItemClick(this.cityMenu, 0, tag);
                    return;
                case "organization":
                    this.infoItemClick(this.organizationMenu, 0, tag);
                    return;
                case "park":
                    this.infoItemClick(this.parkMenu, 0, tag);
                    return;
                case "shop":
                    this.infoItemClick(this.shopMenu, 0, tag);
                    return;
                case "road":
                    this.infoItemClick(this.roadMenu, 0, tag);
                    return;
                case "check":
                    this.infoItemClick(this.checkMenu, 0, tag);
                    return;
                case "feedback":
                    this.infoItemClick(this.feedbackMenu, 0, tag);
                    return;
                case "role":
                    this.infoItemClick(this.roleMenu, 0, tag);
                    return;
            }
            api.toast("功能暂未开放");
        },

        menuItemClick(item) {
            this.menuTag = item.tag;
        },

        go2CenterClick() {
            // api.jumpPage("ManageCenter");
        },
        exitClick() {
            api.jumpPage("Login", {
                reload: true
            }, true);
        },

        getMenuArray() {
            let array = [];
            array.push({
                name: "首页",
                tag: "home",
                url: require("@/project-demo/assets/images/home/menu/ic_home_guide.png"),
                urlSelect: require("@/project-demo/assets/images/home/menu/ic_home_guide_select.png")
            });
            array.push({
                name: "index",
                tag: "park",
                url: require("@/project-demo/assets/images/home/menu/ic_home_park.png"),
                urlSelect: require("@/project-demo/assets/images/home/menu/ic_home_park_select.png")
            });
            array.push({
                name: "index",
                tag: "road",
                url: require("@/project-demo/assets/images/home/menu/ic_home_road.png"),
                urlSelect: require("@/project-demo/assets/images/home/menu/ic_home_road_select.png")
            });
            array.push({
                name: "index",
                tag: "organization",
                url: require("@/project-demo/assets/images/home/menu/ic_home_organization.png"),
                urlSelect: require("@/project-demo/assets/images/home/menu/ic_home_organization_select.png")
            });
            array.push({
                name: "index",
                tag: "shop",
                url: require("@/project-demo/assets/images/home/menu/ic_home_shop.png"),
                urlSelect: require("@/project-demo/assets/images/home/menu/ic_home_shop_select.png")
            });
            array.push({
                name: "index",
                tag: "feedback",
                url: require("@/project-demo/assets/images/home/menu/ic_home_feedback.png"),
                urlSelect: require("@/project-demo/assets/images/home/menu/ic_home_feedback_select.png")
            });
            array.push({
                name: "index",
                tag: "check",
                url: require("@/project-demo/assets/images/home/menu/ic_home_check.png"),
                urlSelect: require("@/project-demo/assets/images/home/menu/ic_home_check_select.png")
            });
            array.push({
                name: "index",
                tag: "system",
                url: require("@/project-demo/assets/images/home/menu/ic_home_system.png"),
                urlSelect: require("@/project-demo/assets/images/home/menu/ic_home_system_select.png")
            });
            array.push({
                name: "index",
                tag: "role",
                url: require("@/project-demo/assets/images/home/menu/ic_home_role.png"),
                urlSelect: require("@/project-demo/assets/images/home/menu/ic_home_role_select.png")
            });
            array.push({
                name: "index",
                tag: "city",
                url: require("@/project-demo/assets/images/home/menu/ic_home_city.png"),
                urlSelect: require("@/project-demo/assets/images/home/menu/ic_home_city_select.png")
            });
            this.menuArray = array;
        },
    },

    mounted() {
        this.getMenuArray();

    }
}